package com.chinanet.entry.faultanticipate;

import com.chinanet.audit.DateAudit;
import com.chinanet.entry.faultanticipate.manager.Keyword;
import com.chinanet.entry.faultanticipate.manager.Relation;
import com.chinanet.entry.faultanticipate.manager.Team;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "detail")
//@QueryEntity
//@DynamicInsert
public class Detail extends DateAudit implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    //@Column(unique = true)
    private String name;

    private int modifiesTimes = 0;

    private String description;

    @OneToMany(mappedBy = "detail", cascade = CascadeType.ALL)
    private List<Branch> branches = new ArrayList<>();

    @ManyToMany(cascade = CascadeType.MERGE)
    private List<Keyword> keywords;

    @ManyToMany(cascade = CascadeType.MERGE)
    private List<Relation> relations;


    @ManyToMany(cascade = CascadeType.MERGE)
    private List<Team> teams;

    private String delmark;

    private int mType;
    public Detail() {

    }


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getModifiesTimes() {
        return modifiesTimes;
    }

    public void setModifiesTimes(int modifiesTimes) {
        this.modifiesTimes = modifiesTimes;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public List<Team> getTeams() {
        return teams;
    }

    public void setTeams(List<Team> teams) {
        this.teams = teams;
    }

    public List<Branch> getBranches() {
        return branches;
    }

    public void setBranches(List<Branch> branches) {
        this.branches = branches;
    }

    public String getDelmark() {
        return delmark;
    }

    public List<Relation> getRelations() {
        return relations;
    }

    public void setRelations(List<Relation> relations) {
        this.relations = relations;
    }

    public void setDelmark(String delmark) {
        this.delmark = delmark;
    }

    public int getmType() {
        return mType;
    }

    public void setmType(int mType) {
        this.mType = mType;
    }

    public List<Keyword> getKeywords() {
        return keywords;
    }

    public void setKeywords(List<Keyword> keywords) {
        this.keywords = keywords;
    }

    @Override
    public String toString() {
        return "Detail{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", modifiesTimes=" + modifiesTimes +
                ", description='" + description + '\'' +
                ", branches=" + branches +
                ", keywords=" + keywords +
                ", relations=" + relations +
                ", teams=" + teams +
                ", delmark='" + delmark + '\'' +
                ", mType=" + mType +
                '}';
    }
}





